Discover amazon com get android video, include the articles, news, trends, analysis and practical advice about amazon com get android video on alibabacloud.com
the ways to get screenshots and thumbnails of video files, and you may also need to save bitmap as a file:
/**
* Bitmap Save As File
* *
* @param bitmap input bitmap
* @param name output file ' s name
* @return String o Utput file ' s path
/public static String Bitmap2file (Bitmap Bitmap, String name) {
file F = new file (environm Ent.getexternalstoragedirectory () + name + ". jpg");
if (f.exists (
can be intercepted to the first frame of the video bitmap to any desired size. The last method can also get a thumbnail image of the memory card.3. If you do not understand the above method, you can view the API, see the address: Click the Open link, here I enclose a description of the method described in the API:Two. Before writing our Android project, take the
.MediaMetadataRetriever class:mediametadataretriever() is not a construction method.The public method of the 4.MediaMetadataRetriever class. For example, as seen in:Watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqv/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/dissolve/70/gravity /southeast ">It is possible to understand the usefulness of these methods according to the explanations. One of the most frequently used methods is the Setdatasource method. Used to set the data source, which can be set from
get video files and thumbnails, and you may also need to Bitmap save them as files: /** * Bitmap saved as file * * @param bitmap input bitmap * @param name output file ' s Nam E * @return String output file ' s path * / Public StaticStringBitmap2file(Bitmap Bitmap, String name) {File F =NewFile (environment.getexternalstoragedirectory () + name +". jpg");if(F.exists ()) F.delete (); FileOutputStream
In the video player often see, there are a lot of video thumbnails, this article is about the Thumbnailutils class to get the thumbnail image of the video file;Run as follows:The code is as follows:Mainactivity.java: PackageCom.vrinux.thumbnailutilsdemo;Importandroid.app.Activity;ImportAndroid.graphics.Bitmap;ImportAnd
* Refer to constants Mini_kind and Micro_kind in the MediaStore.Images.Thumbnails class. * of which, mini_kind:512 x 384,micro_kind:96 x *@returnSpecify the size of the video thumbnail*/ Public StaticBitmap Getvideothumbnail (String Videopath,intWidthintheight,intkind) {Bitmap Bitmap=NULL; //get thumbnail images of a videoBitmap =Thumbnailutils.createvideothumbnail (Videopath, kind); System.out.println
DryStarting with API 8 , a new class has been added:Android.media.ThumbnailUtils This class provides 3 static methods for getting the first frame of the video to get the bitmap,2 of the thumbnail processing of the image. Public Static int kind)The first parameter is the path to the video file, the second parameter is the size of the specified picture, and there a
1, get video thumbnails have two methods (1) through the content provider to get (2) people to create thumbnails
(1) The disadvantage is that the media library must be updated to see the latest video thumbnails
[Java]
Copy Code code as follows:
/**
* @param context
* @param cr
* @param Videopath
* @ret
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.